package com.wb3.meta.common.init;

//import com.wb3.meta.api.core.service.HrBusinessLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;


/**
 * @Author ron
 * @Description //TODO 系统加载，初始化系统配置到redis缓存
 * @Date 22:57 2021/8/9
 * @Param
 * @return
 **/
@Component
@Order(1)
@Slf4j
public class SysGlobalConfigInit implements CommandLineRunner {

//    @Autowired
//    private HrBusinessLogService hrBusinessLogService;
//
//    @Autowired
//    private LogFeignClient logFeignClient;

    @Override
    public void run(String... args) throws Exception {
//        log.debug("系统启动，初始化全局配置到redis");
//        List<SystemTableVo> tableDataVos = logFeignClient.getSystemTableList();
//        if (CollectionUtils.isEmpty(tableDataVos)) {
//            log.debug("未查询到系统表，本次不进行redis存储");
//            return;
//        }
//        tableDataVos.forEach(tableDataVo ->{
//
//            String tKey = EnumRedisKey.HR_TABLE_COLUMNS_COMMENTS_KEY.getKey() + tableDataVo.getTableName().toUpperCase();
//            List<Map<String, Object>> tableCommentsDataList = hrBusinessLogService.getTableCommentsByTableName(tableDataVo.getTableName().toUpperCase());
//            if (!CollectionUtils.isEmpty(tableCommentsDataList)) {
//                redisUtils.set(tKey, tableCommentsDataList);
//                log.debug("key:{},value:{},存入redis成功", tKey, JSONArray.toJSONString(tableCommentsDataList));
//            }
//        });
//        log.debug("系统启动，初始化表字段定义到redis完成");
    }
}

